package com.batchbrake.queue.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import com.batchbrake.main.BatchBrakeProc;
import com.batchbrake.queue.QueueEntity;
import com.batchbrake.queue.QueuePanel;

public class RemoveSelectedAction extends AbstractAction {
	private QueuePanel queuePanel = null;
	private BatchBrakeProc proc = null;
	
	public RemoveSelectedAction(QueuePanel queuePanel, BatchBrakeProc proc) {
		super("Remove selected");
		this.queuePanel = queuePanel;
		this.proc = proc;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		QueueEntity[] entities = queuePanel.getSelectedRows();
		
		for( int i = 0; i < entities.length; i++ ) {
			proc.removeFromQueue(entities[i]);
		}
	}

}
